<!--# layout("/common/layout.html",{"jsBase":"/js/customer/customerInfo/"}){ -->

<form class="layui-form layui-form-pane" id="addForm" lay-filter="editform">
    <input type="hidden" name="customerId" id="customerId">

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员id </label>
                <div class="layui-input-inline">
                                    <span style="line-height:38px;margin-left:8px">
                                        ${customerInfo.customerId}
                                    </span>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">来源id</label>
                <div class="layui-input-inline">
                                    <span style="line-height:38px;margin-left:8px;white-space:nowrap;">
                                        ${customerInfo.sourceId}
                                    </span>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">来源子id</label>
                <div class="layui-input-inline">
                                    <span style="line-height:38px;margin-left:8px">
                                        ${customerInfo.subSourceId}
                                    </span>
                </div>
            </div>
        </div>
    </div>


    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">来源模块</label>
                <div class="layui-input-inline">
                                    <span style="line-height:38px;margin-left:8px">
                                        ${customerInfo.moduleName}
                                    </span>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">微信昵称</label>
                <div class="layui-input-inline">
                                    <span style="line-height:38px;margin-left:8px">
                                        ${customerInfo.wxUname}
                                    </span>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">注册时间</label>
                <div class="layui-input-inline">
                    <span style="line-height:38px;margin-left:8px">
                    ${customerInfo.registerTime,"yyyy-MM-dd HH:mm:ss"}
                    </span>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">绑定手机号</label>
                <div class="layui-input-inline">
                    <span style="line-height:38px;margin-left:8px">
                        ${customerInfo.phone}
                    </span>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员类型</label>
                <input type="hidden" name="customerType" value="0"/>
                <div class="layui-input-inline">
                    <span style="line-height:38px;margin-left:8px">
                        员工
                    </span>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">对应员工</label>
                <div class="layui-input-inline">
                    <layui:simpleDataSelect name="userId" value="${userId!}" data="${userList}"
                                            attrId="id" attrName="name" laySearch="true" />
                </div>
            </div>


        </div>
    </div>
    <layui:submitButtons id="addButton" />
</form>
<!--#} -->
<script>
    Common.initImage();
    layui.define([ 'form', 'laydate', 'table','customerInfoApi'], function(exports) {
        var form = layui.form;
        var customerInfoApi = layui.customerInfoApi;
        var index = layui.index;
        var isNew = true;
        <!--# if(!(isEmpty(customerInfoJson))){  -->
        isNew = false;
        <!--# } -->
        var view = {
            init:function(){
                Lib.initGenrealForm($("#addForm"),form);
                this.initSubmit();
            },
            initSubmit:function(){
                $("#addButton").click(function(){
                    form.on('submit(form)', function(){
                        customerInfoApi.saveEmp($('#addForm'),function(){
                            parent.window.dataReload();
                            Common.info("保存成功");
                            Lib.closeFrame();
                        });
                    });
                });

                $("#addButton-cancel").click(function(){
                    Lib.closeFrame();
                });
            }

        }
        view.init();
        <!--# if(!(isEmpty(customerInfoJson))){  -->
        var formJson = ${customerInfoJson};
        form.val("editform",formJson);
        $(".image-preview").each(function() {
            $(this).attr("src",formJson[$(this).attr("id")]);
        });
        <!--# } -->
    });
</script>
